//
//  AppDelegate.m
//  HellowWeex
//
//  Created by 金宝泉 on 17/3/1.
//  Copyright © 2017年 x298017064010. All rights reserved.
//

#import "AppDelegate.h"
#import "DemoViewController.h"

#import <WeexSDK/WeexSDK.h>
#import <TBWXDevtool/WXDevtool.h>
#import "WXEventModule.h"
#import "WXImgLoaderDefaultImpl.h"
#import "WXNavigatorDefaultImpl.h"


#import "CCWeexViewController.h"

#import "ZHHomeAllViewController.h"
#import "QQDrawerViewController.h"
#import "QQLeftTableViewController.h"
#import "QQMainTabBarController.h"
#import "LeftViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
//    ZHHomeAllViewController *homeVC = [[ZHHomeAllViewController alloc] init];
    
    //  创建左视图
//    QQLeftTableViewController *leftViewController = [[QQLeftTableViewController alloc] init];
    LeftViewController *leftVC = [[LeftViewController alloc] init];
    //  创建主视图
    QQMainTabBarController *mainViewController = [[QQMainTabBarController alloc] init];
    //  传入左视图和主视图以及抽屉的最大宽度 创建抽屉
    QQDrawerViewController *rootViewController = [QQDrawerViewController drawerWithLeftViewController:leftVC andMainViewController:mainViewController andMaxWidth:300];

//    UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:rootViewController];
    self.window.rootViewController = rootViewController;
    
    [self configWeex];
    
    
    return YES;
}

- (void)configWeex {
    
    // 开启debug模式的话, 会导致页面刷不出来, 必须注释掉!!!
//    [WXDevTool setDebug:YES];
//    [WXDevTool launchDevToolDebugWithUrl:@"ws://172.20.12.21:8088/debugProxy/native"];

    //业务配置，非必需
    [WXAppConfiguration setAppGroup:@"AliApp"];
    [WXAppConfiguration setAppName:@"WeexDemo"];
    [WXAppConfiguration setAppVersion:@"1.0.0"];
    
    //初始化SDK环境
    [WXSDKEngine initSDKEnvironment];
    
    //注册自定义component，非必需
    //    [WXSDKEngine registerComponent:@"MyView" withClass:[MyViewComponent class]];
    
    //注册自定义module, 非必须
    [WXSDKEngine registerModule:@"event" withClass:[WXEventModule class]];
    
    //注册协议的实现类，非必需
    [WXSDKEngine registerHandler:[WXImgLoaderDefaultImpl new] withProtocol:@protocol(WXImgLoaderProtocol)];
    [WXSDKEngine registerHandler:[WXNavigatorDefaultImpl new] withProtocol:@protocol(WXNavigationProtocol)];

    
    //设置Log输出等级：调试环境默认为Debug，正式发布会自动关闭。
    [WXLog setLogLevel:WXLogLevelError];
}

@end
